// Only in player setup

_idx = player getVariable "Action_Id_Options";
if (!isnil "_idx") then { if (_idx <= -9999) then { player removeAction _idx; } };
player removeAllEventHandlers "killed";
waituntil {X_INIT && alive player};

if (isnil "DPlayerIsSetUp") then {
	// Here comes the code which has to be executed only once.
	if (PR_PLAYERS_CAN_FLIP > 0) then {
		dm_objectID1 = objNull;
		actionID1 = -9999;
		[[0,0,0], [0, 0, 0, false], ["NONE", "PRESENT", true], ["call fnFlip", Format["actionID1= player addAction ['%1' call XGreyText, 'base\client\unflip_vehicle.sqf',[dm_objectID1],-1,false];", localize "STR_MSG_UNFLIP"], "player removeAction actionID1"]] call XfCreateTrigger;
	};

	DPlayerIsSetUp = true;
};

// Creates missing tasks after death.
// call InitTasks;
// call InitActions;

execVM "base\mission\mission_init.sqf";

player addEventHandler ["killed", {_this execVM "base\client\player_setup.sqf";}];

_idx = player getVariable "Action_Id_Options";
if (!isnil "_idx") then { if (_idx >= 0) then { player removeAction _idx; };};
_idx = player addAction ["Options...", "base\options\Show_Options.sqf",[],-1,false];
player setVariable ["Action_Id_Options",_idx];
